<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
</head>
<body>

<!--
    关系运算符   ->  布尔类型  true  false
    ==
    ===
    !=
    !==
    >
    <
    >=
    <=
    ?  三目运算
 -->

<script type="text/javascript">

    var num1 = 10
    var num2 = 2
    var str = '1'

    console.log("1>2 = " + (num1 > num2));
    console.log("1>=2 = " + (num1 >= num2));
    console.log("1==2 = " + (num1 == num2));
    console.log("1!=2 = " + (num1 != num2));
    console.log("1<2 = " + (num1 < num2));
    console.log("1<=2 = " + (num1 <= num2));
    console.log("1<=1 = " + (1 <= 1));

    console.log("-------------------------------------");

    // 只比较数值 不关心类型
    console.log("1=='1'" + (num1 == str));

    //  数值和类型必须都要相同   true
    console.log("1==='1'" + (num1 === str));

    console.log("--------------------------");

    // false
    console.log("1!='1'" + (num1 != str));

    // true
    console.log("1!=='1'" + (num1 !== str));


    // ? 三目运算符   双分支   if  else
    /*
     *  num1 > num2  ?  "大于":"小于"
     *      表达式       结果1 ：  结果2
     *
     *     true       结果1
     * 	  false       结果2
     *
     * if(true){
         *
         *
        }else{}
     */
    // var  res =  num1 > num2  ?  "大于":"小于"

    var res = num1 > num2 ? ++num2 : num1++

    console.log(res);  //  2  3

</script>
</body>
</html>
